<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="com.qs.po.*"%>
<%@page import="com.qs.vo.*"%>
<%@page import="com.qs.enums.*"%>
<%@page import="com.qs.service.*"%>
<%@page import="com.infomanage.po.*"%>
<%  response.addDateHeader("Expires", 0);response.setHeader("Pragma","no-cache"); response.setHeader("Cache-Control","no-cache");%>
<%
	request.setCharacterEncoding("UTF-8");
	String itemId = request.getParameter("itemId");
    if(itemId == null) itemId = "";
    
    QsCtPhyTestItem item = CtPhysicalTestService.load(request, response, out);
    String description = "";
    int fuzhong = 0;
    int juzhong = 0;
    int lali = 0;
    String name = "";
    String pasheng = "";
    int personId = -1;
    int tiaogao = 0;
    int deptId = -1;
    String deptname = "";
    String tiaoyuan = "";
    String timestamp = "";
    String yaling = "";
    String yalingUp = "";
    String yalingMid = "";
    String yalingBot = "";
    String personName = "";
    int yinti = 0;
    String paobaoMin = "";
    String paobaoSec = "";
    float score = 0;
    if(item != null) {
    	QsCtPhyTest bean = item.getBean();
    	Person person = item.getPerson();
    	Department dept = item.getDept();
    	personName = person.getName();
    	description = bean.getDescription();
    	fuzhong = bean.getFuzhong();
    	juzhong = bean.getJuzhong();
    	lali = bean.getLali();
    	name = bean.getName();
    	pasheng = bean.getPasheng();
    	personId = bean.getPersonId();
    	tiaogao = bean.getTiaogao();
    	tiaoyuan = bean.getTiaoyuan();
    	timestamp = bean.getTimestamp();
    	yinti = bean.getYinti();
    	yalingUp = bean.getYalingUp();
    	yalingMid = bean.getYalingMid();
    	yalingBot = bean.getYalingBot();
    	paobaoMin = bean.getPaobuMin() == null ? "" : bean.getPaobuMin();
    	paobaoSec = bean.getPaobuSec() == null ? "" : bean.getPaobuSec();
    	deptId = bean.getDeptId();
    	deptname = dept.getPath();
    	score = bean.getScore();
    } 
%>
<html>
<head>
	<title>体质训练</title>
	<link href="<%=request.getContextPath() %>/css/style.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/table.css" rel="stylesheet" type="text/css">
	<link href="<%=request.getContextPath() %>/css/calendar.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/calendar.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/common.js"></script>
	<script type="text/javascript">
	 function init() {
		   if("" != "<%=itemId%>") { // 修改
		   }
	   }
	   // 提交
	   function doSubmit(){
	   		if(validate()){
	   			return;
	   		}
	   		form1.yaling.value = form1.yalingUp.value + ";" + form1.yalingMid.value + ";" + form1.yalingBot.value;
		 	if("" == "<%=itemId%>") {
		 		form1.actionType.value = "add";
			}else {
		 		form1.actionType.value = "modify";
			}
		 	form1.submit();
	   }

	   function validate(){
	   		if(form1.timestamp.value == ""){
	   			alert("日期不能为空！");
	   			return true;
	   		}
	   		if(form1.personId.value == -1){
	   			alert("姓名不能为空！");
	   			return true;
	   		}
	   			   	
	   		if(isNaN(form1.yinti.value)){
	   			alert("引体向上(次)必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.juzhong.value)){
	   			alert("举重30kg(次)必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.tiaogao.value)){
	   			alert("跳高(M)必须为数字！");
	   			return true;
	   		}
	   		if(isNaN(form1.fuzhong.value)){
	   			alert("负重蹲起40kg(次)必须为数字！");
	   			return true;
	   		}
	   		
	   		if(isNaN(form1.lali.value)){
	   			alert("拉验力器(次/秒)必须为数字！");
	   			return true;
	   		}
	   		return false;
	   }
	   function showError(error){
		   alert(error);
	   }

	   function showInfo(info){
		   alert(info);
		   window.returnValue = "ok";
		   window.close();
	   }
	</script>
</head>
<body  rightmargin="0" bottommargin="0" leftmargin="0" topmargin="0" onclick="clickBody();" onload="init();">
	<form name="form1" action="physicalTest_action.jsp" method="post" target="actionFrame">
	<input type="hidden" name="itemId" value="<%=itemId%>">
	<input type="hidden" name="actionType">
	<input value="" type="hidden" name="paobu">
	<input value="" type="hidden" name="yaling">
	<table class="dialogTable" cellpadding="0" cellspacing="0">
		<!-- 表头-->
		<tr class="dialogTableHeader">
			<td>体质训练</td>
		</tr>
		<!-- 表数据-->
		<tr class="dialogTableContent">
			<td>
				<!-- 数据项 -->
				<table class="dataTable">
					<col width="15%">
					<col width="35%">
					<col width="18%">
					<col width="32%">
					<tr>
						<td class="field">
							小队
						</td>
						<td colspan="3">
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/deptTree.jsp');" treeSelect="true">
								<input name="deptname" value="<%=deptname %>" style="width: 100%;" readonly="readonly" 
								treeSelect="true"><input value="<%=deptId %>" name="deptId"  type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							日期
						</td>
						<td height="25px" valign="middle" style="padding-left:5px" colspan="3">
							<input value="<%=timestamp%>" type="text" name="timestamp" style="width: 180px;cursor: hand;" id="time" onClick="return showCalendar(this.id, 'y-mm-dd');" readonly="readonly"><img 
									src="<%=request.getContextPath() %>/img/tip_calender.gif" style="cursor: hand;" width="16" height="16" onClick="return showCalendar('time', 'y-mm-dd');">
						</td>

					</tr>
					<tr>
						<td class="field">
							姓名
						</td>
						<td colspan="3">
							<span class="treeSpan" onclick="showTree(this, '<%=request.getContextPath() %>/infomanage/common/personTree.jsp');" treeSelect="true">
								<input value="<%=personName %>" style="width: 100%" readonly="readonly" treeSelect="true"><input name="personId" value="<%=personId %>" type="hidden">
							</span>
						</td>
					</tr>
					<tr>
						<td class="field">
							引体向上(次)
						</td>
						<td>
							<input value="<%=yinti %>" name="yinti" type="text" style="width:100%;">
						</td>
						<td class="field">
							举重30kg(次)
						</td>
						<td>
							<input value="<%=juzhong %>" name="juzhong" type="text" style="width:100%;">
						</td>
					</tr>
					<tr>
						<td class="field">
							跳高(M)
						</td>
						<td>
							<input value="<%=tiaogao%>" name="tiaogao" style="width: 100%" type="text">
						</td>
						<td class="field">
							跳远(M)
						</td>
						<td>
							<input value="<%=tiaoyuan%>" name="tiaoyuan" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td class="field">
							爬绳(M)
						</td>
						<td>
							<input value="<%=pasheng%>" name="pasheng" style="width: 100%" type="text">
						</td>
						<td class="field">
							负重蹲起40kg(次)
						</td>
						<td>
							<input value="<%=fuzhong%>" name="fuzhong" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td class="field">
							跑步2000M
						</td>
						<td>
							<input value="<%=paobaoMin %>" name="paobuMin" style="width:50px;">&nbsp;分
							<input value="<%=paobaoSec %>" name="paobuSec" style="width:50px;">&nbsp;秒
						</td>
						<td class="field">
							拉验力器(次/秒)
						</td>
						<td>
							<input value="<%=lali%>" name="lali" style="width: 100%" type="text">
						</td>
					</tr>
				</table>
				<table class="dataTable2">
					<col width="15%">
					<col width="10%">
					<col width="75%">
					<tr>
						<td class="field" rowspan="3">
							哑铃
						</td>
						<td>
							上
						</td>
						<td>
							<input value="<%=yalingUp%>" name="yalingUp" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td>
							中
						</td>
						<td>
							<input value="<%=yalingMid%>" name="yalingMid" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td>
							下
						</td>
						<td>
							<input value="<%=yalingBot%>" name="yalingBot" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td class="field">
							得分
						</td>
						<td colspan="3">
							<input value="<%=score%>" name="score" style="width: 100%" type="text">
						</td>
					</tr>
					<tr>
						<td class="field">
							满分
						</td>
						<td colspan="3">
							10分
						</td>
					</tr>
					<tr style="height: 80px">
						<td class="field">
							备注
						</td>
						<td valign="top" colspan="2">
						</td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td class="tableBtn">
				<span onclick="doSubmit();">确定</span>
				<span onclick="window.close();">取消</span>
			</td>
		</tr>
		<tr valign="top">
			<td>
				&nbsp;
			</td>
		</tr>
	</table>
	</form>
	<iframe src="#" frameborder="0" id="treeFrame" name="frame" style="display: none;position: absolute;"></iframe>
	<iframe src="#" name="actionFrame" style="display: none;"></iframe>
</body>
</html>